﻿@using Res = ViewRes.Discussion.IndexStrings

<div data-bind="visible: selectedFolder() === null" class="row-fluid">
	
	<div class="span8">
		<table class="table">
			<thead>
				<tr>
					<th>@Res.Folder</th>
					<th>@Res.Topics</th>
					<th>@Res.LastTopic</th>
				</tr>
			</thead>
			<tbody data-bind="foreach: folders" class="discussion-folders">
				<tr data-bind="css: { active: $data == $parent.selectedFolder() }, click: function() { $parent.selectFolder($data); }">
					<td>
						<span class="discussion-folder-name">{{name}}</span>
						<span class="discussion-folder-description">{{description}}</span>
					</td>
					<td>
						<span>{{topicCount}}</span>
					</td>
					<td>
						<span data-bind="visible: $data.lastTopicDate">{{$data.lastTopicDate | formatDate:'lll'}} by {{$data.lastTopicAuthor != null ? lastTopicAuthor.name : ''}}</span>
					</td>
				</tr>
			</tbody>
		</table>
	</div>

	<div class="span4" data-bind="visible: recentTopics().length">
		<h4>@Res.RecentTopics</h4>		
		<table class="table">
			<tbody data-bind="foreach: recentTopics" class="discussion-folders">
				<tr data-bind="click: function() { $parent.selectTopic($data); }">
					<td>
						{{name}}<br />
						<span class="extraInfo">{{created | formatDate:'lll'}} by {{author.name}}</span>
					</td>
				</tr>
			</tbody>
		</table>
	</div>

</div>